package constants;

import java.io.FileWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.text.DateFormat;
import java.util.Date;

public class Log {
	private static final String LOGFILE = "auditLog";
	private static final String SEPERATOR = " : ";
	public static void write(String action){
		FileWriter writer;
		DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM);
		Date date = new Date();
		String currentTime = df.format(date);
		try {
			writer = new FileWriter(LOGFILE, true);
			writer.write(currentTime + SEPERATOR + action+ "\n");
			writer.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
